﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GaiNo.Core.Extensions
{
    public static class LinqExtensions
    {
        public static void Each<T>(this IEnumerable<T> col, Action<T> handler)
        {
            if (col == null)
                return;
            foreach (var item in col)
            {
                handler(item);
            }
        }

        public static void Each<T>(this IEnumerable<T> col, Func<T, bool> handler)
        {
            foreach (var item in col)
            {
                if (!handler(item))
                    break;
            }
        }
    }
}
